(function($){ "use strict"; $(document).ready(function(){ var aviabodyclasses=AviaBrowserDetection('html'); $.avia_utilities=$.avia_utilities||{}; if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&'ontouchstart' in document.documentElement){ $.avia_utilities.isMobile=true; }else{ $.avia_utilities.isMobile=false; } avia_hamburger_menu(); avia_scroll_top_fade(); aviaCalcContentWidth(); new $.AviaTooltip({"class": 'avia-search-tooltip',data: 'avia-search-tooltip', event:'click', position:'bottom', scope: "body", attach:'element', within_screen: true}); new $.AviaTooltip({"class": 'avia-related-tooltip', data: 'avia-related-tooltip', scope: ".related_posts, .av-share-box", attach:'element', delay:0}); new $.AviaAjaxSearch({scope:'#header, .avia_search_element'}); if($.fn.avia_iso_sort) $('.grid-sort-container').avia_iso_sort(); AviaSidebarShaowHelper(); $.avia_utilities.avia_ajax_call(); }); $.avia_utilities=$.avia_utilities||{}; $.avia_utilities.avia_ajax_call=function(container){ if(typeof container=='undefined'){ container='body';}; $('a.avianolink').on('click', function(e){ e.preventDefault(); }); $('a.aviablank').attr('target', '_blank'); if($.fn.avia_activate_lightbox){ $(container).avia_activate_lightbox(); } if($.fn.avia_scrollspy){ if(container=='body'){ $('body').avia_scrollspy({target:'.main_menu .menu li > a'}); }else{ $('body').avia_scrollspy('refresh'); }} if($.fn.avia_smoothscroll) $('a[href*="#"]', container).avia_smoothscroll(container); avia_small_fixes(container); avia_hover_effect(container); avia_iframe_fix(container); if($.fn.avia_html5_activation&&$.fn.mediaelementplayer) $(".avia_video, .avia_audio", container).avia_html5_activation({ratio:'16:9'}); }; $.avia_utilities.log=function(text, type, extra){ if(typeof console=='undefined'){return;} if(typeof type=='undefined'){type="log";} type="AVIA-" + type.toUpperCase(); console.log("["+type+"] "+text); if(typeof extra!='undefined') console.log(extra); }; function aviaCalcContentWidth(){ var win=$(window), width_select=$('html').is('.html_header_sidebar') ? "#main":"#header", outer=$(width_select), outerParent=outer.parents('div:eq(0)'), the_main=$(width_select + ' .container:first'), css_block="", calc_dimensions=function(){ var css="", w_12=Math.round(the_main.width()), w_outer=Math.round(outer.width()), w_inner=Math.round(outerParent.width()); css +=" #header .three.units{width:" +(w_12 * 0.25)+ "px;}"; css +=" #header .six.units{width:" +(w_12 * 0.50)+ "px;}"; css +=" #header .nine.units{width:" +(w_12 * 0.75)+ "px;}"; css +=" #header .twelve.units{width:" +(w_12) + "px;}"; css +=" .av-framed-box .av-layout-tab-inner .container{width:" +(w_inner)+ "px;}"; css +=" .html_header_sidebar .av-layout-tab-inner .container{width:" +(w_outer)+ "px;}"; css +=" .boxed .av-layout-tab-inner .container{width:" +(w_outer)+ "px;}"; css +=" .av-framed-box#top .av-submenu-container{width:" +(w_inner)+ "px;}"; try{ css_block.text(css); } catch(err){ css_block.remove(); css_block=$("").appendTo('head:first'); }}; if($('.avia_mega_div').length > 0||$('.av-layout-tab-inner').length > 0||$('.av-submenu-container').length > 0){ css_block=$("").appendTo('head:first'); win.on('debouncedresize', calc_dimensions); calc_dimensions(); }} function AviaSidebarShaowHelper(){ var $sidebar_container=$('.sidebar_shadow#top #main .sidebar'); var $content_container=$('.sidebar_shadow .content'); if($sidebar_container.height() >=$content_container.height()){ $sidebar_container.addClass('av-enable-shadow'); }else{ $content_container.addClass('av-enable-shadow'); }} function AviaScrollSpy(element, options){ var self=this; var process=$.proxy(self.process, self) , refresh=$.proxy(self.refresh, self) , $element=$(element).is('body') ? $(window):$(element) , href; self.$body=$('body'); self.$win=$(window); self.options=$.extend({}, $.fn.avia_scrollspy.defaults, options); self.selector=(self.options.target || ((href=$(element).attr('href'))&&href.replace(/.*(?=#[^\s]+$)/, '')) || ''); self.activation_true=false; if(self.$body.find(self.selector + "[href*='#']").length){ self.$scrollElement=$element.on('scroll.scroll-spy.data-api', process); self.$win.on('av-height-change', refresh); self.$body.on('av_resize_finished', refresh); self.activation_true=true; self.checkFirst(); setTimeout(function(){ self.refresh(); self.process(); },100); }} AviaScrollSpy.prototype={ constructor: AviaScrollSpy , checkFirst: function (){ var current=window.location.href.split('#')[0], matching_link=this.$body.find(this.selector + "[href='"+current+"']").attr('href',current+'#top'); } , refresh: function (){ if(!this.activation_true) return; var self=this , $targets; this.offsets=$([]); this.targets=$([]); $targets=this.$body .find(this.selector) .map(function (){ var $el=$(this) , href=$el.data('target')||$el.attr('href') , hash=this.hash , hash=hash.replace(/\//g, "") , $href=/^#\w/.test(hash)&&$(hash); return($href && $href.length && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0))&&self.$scrollElement.scrollTop()), href ]])||null; }) .sort(function (a, b){ return a[0] - b[0]; }) .each(function (){ self.offsets.push(this[0]); self.targets.push(this[1]); }); } , process: function (){ if(!this.offsets) return; if(isNaN(this.options.offset)) this.options.offset=0; var scrollTop=this.$scrollElement.scrollTop() + this.options.offset , scrollHeight=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight , maxScroll=scrollHeight - this.$scrollElement.height() , offsets=this.offsets , targets=this.targets , activeTarget=this.activeTarget , i; if(scrollTop >=maxScroll){ return activeTarget!=(i=targets.last()[0]) && this.activate(i); } for (i=offsets.length; i--;){ activeTarget!=targets[i] && scrollTop >=offsets[i] && (!offsets[i + 1]||scrollTop <=offsets[i + 1]) && this.activate(targets[i]); }} , activate: function (target){ var active , selector; this.activeTarget=target; $(this.selector) .parent('.' + this.options.applyClass) .removeClass(this.options.applyClass); selector=this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]'; active=$(selector) .parent('li') .addClass(this.options.applyClass); if(active.parent('.sub-menu').length){ active=active.closest('li.dropdown_ul_available').addClass(this.options.applyClass); } active.trigger('activate'); }}; $.fn.avia_scrollspy=function (option){ return this.each(function (){ var $this=$(this) , data=$this.data('scrollspy') , options=typeof option=='object'&&option; if(!data) $this.data('scrollspy', (data=new AviaScrollSpy(this, options))); if(typeof option=='string') data[option](); }); }; $.fn.avia_scrollspy.Constructor=AviaScrollSpy; $.fn.avia_scrollspy.calc_offset=function(){ var offset_1=(parseInt($('.html_header_sticky #main').data('scroll-offset'), 10))||0, offset_2=($(".html_header_sticky:not(.html_top_nav_header) #header_main_alternate").outerHeight())||0, offset_3=($(".html_header_sticky.html_header_unstick_top_disabled #header_meta").outerHeight())||0, offset_4=1, offset_5=parseInt($('html').css('margin-top'),10)||0, offset_6=parseInt($('.av-frame-top ').outerHeight(),10)||0; return offset_1 + offset_2 + offset_3 + offset_4 + offset_5 + offset_6; }; $.fn.avia_scrollspy.defaults = { offset: $.fn.avia_scrollspy.calc_offset(), applyClass: 'current-menu-item' }; function AviaBrowserDetection(outputClassElement){ var current_browser={}, uaMatch=function(ua){ ua=ua.toLowerCase(); var match=/(edge)\/([\w.]+)/.exec(ua) || /(opr)[\/]([\w.]+)/.exec(ua) || /(chrome)[ \/]([\w.]+)/.exec(ua) || /(iemobile)[\/]([\w.]+)/.exec(ua) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("trident") >=0&&/(rv)(?::|)([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; return { browser: match[ 5 ]||match[ 3 ]||match[ 1 ]||"", version: match[ 2 ]||match[ 4 ]||"0", versionNumber: match[ 4 ]||match[ 2 ]||"0" };}; var matched=uaMatch(navigator.userAgent); if(matched.browser){ current_browser.browser=matched.browser; current_browser[ matched.browser ]=true; current_browser.version=matched.version; } if(current_browser.chrome){ current_browser.webkit=true; }else if(current_browser.webkit){ current_browser.safari=true; } if(typeof(current_browser)!=='undefined'){ var bodyclass='', version=current_browser.version ? parseInt(current_browser.version):""; if(current_browser.msie||current_browser.rv||current_browser.iemobile){ bodyclass +='avia-msie'; }else if(current_browser.webkit){ bodyclass +='avia-webkit'; }else if(current_browser.mozilla){ bodyclass +='avia-mozilla'; } if(current_browser.version) bodyclass +=' ' + bodyclass + '-' + version + ' '; if(current_browser.browser) bodyclass +=' avia-' + current_browser.browser + ' avia-' +current_browser.browser +'-' + version + ' '; } if(outputClassElement) $(outputClassElement).addClass(bodyclass); return bodyclass; } $.fn.avia_html5_activation=function(options){ var defaults = { ratio: '16:9' }; var options=$.extend(defaults, options), isMobile=$.avia_utilities.isMobile; this.each(function(){ var fv=$(this), id_to_apply='#' + fv.attr('id'), posterImg=fv.attr('poster'); fv.mediaelementplayer({ defaultVideoWidth: 480, defaultVideoHeight: 270, videoWidth: -1, videoHeight: -1, audioWidth: 400, audioHeight: 30, startVolume: 0.8, loop: false, enableAutosize: false, features: ['playpause','progress','current','duration','tracks','volume'], alwaysShowControls: false, iPadUseNativeControls: false, iPhoneUseNativeControls: false, AndroidUseNativeControls: false, alwaysShowHours: false, showTimecodeFrameCount: false, framesPerSecond: 25, enableKeyboard: true, pauseOtherPlayers: false, poster: posterImg, success: function (mediaElement, domObject, instance){ $.AviaVideoAPI.players[ fv.attr('id').replace(/_html5/,'') ]=instance; setTimeout(function(){ if(mediaElement.pluginType=='flash'){ mediaElement.addEventListener('canplay', function(){ fv.trigger('av-mediajs-loaded'); }, false); }else{ fv.trigger('av-mediajs-loaded').addClass('av-mediajs-loaded'); } mediaElement.addEventListener('ended', function(){ fv.trigger('av-mediajs-ended'); }, false); },10); }, error: function (){ }, keyActions: [] }); }); }; function avia_hover_effect(container){ if($.avia_utilities.isMobile) return; if($('body').hasClass('av-disable-avia-hover-effect')){ return; } var overlay="", cssTrans=$.avia_utilities.supports('transition'); if(container=='body'){ var elements=$('#main a img').parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('#main .avia-hover-fx'); }else{ var elements=$('a img', container).parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('.avia-hover-fx', container); } elements.each(function(e){ var link=$(this), current=link.find('img:first'); if(current.hasClass('alignleft')) link.addClass('alignleft').css({float:'left', margin:0, padding:0}); if(current.hasClass('alignright')) link.addClass('alignright').css({float:'right', margin:0, padding:0}); if(current.hasClass('aligncenter')) link.addClass('aligncenter').css({float:'none','text-align':'center', margin:0, padding:0}); if(current.hasClass('alignnone')){ link.addClass('alignnone').css({margin:0, padding:0});; if(!link.css('display')||link.css('display')=='inline'){ link.css({display:'inline-block'});}} if(!link.css('position')||link.css('position')=='static'){ link.css({position:'relative', overflow:'hidden'});} var url=link.attr('href'), span_class="overlay-type-video", opa=link.data('opacity')||0.7, overlay_offset=5, overlay=link.find('.image-overlay'); if(url){ if(url.match(/(jpg|gif|jpeg|png|tif)/)) span_class="overlay-type-image"; if(!url.match(/(jpg|gif|jpeg|png|\.tif|\.mov|\.swf|vimeo\.com|youtube\.com)/)) span_class="overlay-type-extern"; } if(!overlay.length){ overlay=$("").appendTo(link); } link.on('mouseenter', function(e){ var current=link.find('img:first'), _self=current.get(0), outerH=current.outerHeight(), outerW=current.outerWidth(), pos=current.position(), linkCss=link.css('display'), overlay=link.find('.image-overlay'); if(outerH > 100){ if(!overlay.length){ overlay=$("").appendTo(link); } if(link.height()==0){ link.addClass(_self.className); _self.className=""; } if(!linkCss||linkCss=='inline'){ link.css({display:'block'});} overlay.css({left:(pos.left - overlay_offset) + parseInt(current.css("margin-left"),10), top:pos.top + parseInt(current.css("margin-top"),10)}) .css({overflow:'hidden',display:'block','height':outerH,'width':(outerW + (2*overlay_offset))}); if(cssTrans===false) overlay.stop().animate({opacity:opa}, 400); }else{ overlay.css({display:"none"}); }}).on('mouseleave', elements, function(){ if(overlay.length){ if(cssTrans===false) overlay.stop().animate({opacity:0}, 400); }}); }); } (function($){ $.fn.avia_smoothscroll=function(apply_to_container){ if(!this.length) return; var the_win=$(window), $header=$('#header'), $main=$('.html_header_top.html_header_sticky #main').not('.page-template-template-blank-php #main'), $meta=$('.html_header_top.html_header_unstick_top_disabled #header_meta'), $alt=$('.html_header_top:not(.html_top_nav_header) #header_main_alternate'), menu_above_logo=$('.html_header_top.html_top_nav_header'), shrink=$('.html_header_top.html_header_shrinking').length, frame=$('.av-frame-top'), fixedMainPadding=0, isMobile=$.avia_utilities.isMobile, sticky_sub=$('.sticky_placeholder:first'), calc_main_padding=function(){ if($header.css('position')=="fixed"){ var tempPadding=parseInt($main.data('scroll-offset'),10)||0, non_shrinking=parseInt($meta.outerHeight(),10)||0, non_shrinking2=parseInt($alt.outerHeight(),10)||0; if(tempPadding > 0&&shrink){ tempPadding=(tempPadding / 2) + non_shrinking + non_shrinking2; }else{ tempPadding=tempPadding + non_shrinking + non_shrinking2; } tempPadding +=parseInt($('html').css('margin-top'),10); fixedMainPadding=tempPadding; }else{ fixedMainPadding=parseInt($('html').css('margin-top'),10); } if(frame.length){ fixedMainPadding +=frame.height(); } if(menu_above_logo.length){ fixedMainPadding=$('.html_header_sticky #header_main_alternate').height() + parseInt($('html').css('margin-top'),10); } if(isMobile){ fixedMainPadding=0; }}; if(isMobile) shrink=false; calc_main_padding(); the_win.on("debouncedresize av-height-change", calc_main_padding); var hash=window.location.hash.replace(/\//g, ""); if(fixedMainPadding > 0&&hash&&apply_to_container=='body'&&hash.charAt(1)!="!"&&hash.indexOf("=")===-1){ var scroll_to_el=$(hash), modifier=0; if(scroll_to_el.length){ the_win.on('scroll.avia_first_scroll', function(){ setTimeout(function(){ if(sticky_sub.length&&scroll_to_el.offset().top > sticky_sub.offset().top){ modifier=sticky_sub.outerHeight() - 3; } the_win.off('scroll.avia_first_scroll').scrollTop(scroll_to_el.offset().top - fixedMainPadding - modifier); },10); }); }} return this.each(function(){ $(this).click(function(e){ var newHash=this.hash.replace(/\//g, ""), clicked=$(this), data=clicked.data(); if(newHash!=''&&newHash!='#'&&newHash!='#prev'&&newHash!='#next'&&!clicked.is('.comment-reply-link, #cancel-comment-reply-link, .no-scroll')){ var container="", originHash=""; if("#next-section"==newHash){ originHash=newHash; container=clicked.parents('.container_wrap:eq(0)').nextAll('.container_wrap:eq(0)'); newHash='#' + container.attr('id') ; }else{ container=$(this.hash.replace(/\//g, "")); } if(container.length){ var cur_offset=the_win.scrollTop(), container_offset=container.offset().top, target=container_offset - fixedMainPadding, hash=window.location.hash, hash=hash.replace(/\//g, ""), oldLocation=window.location.href.replace(hash, ''), newLocation=this, duration=data.duration||1200, easing=data.easing||'easeInOutQuint'; if(sticky_sub.length&&container_offset > sticky_sub.offset().top){ target -=sticky_sub.outerHeight() - 3;} if(oldLocation+newHash==newLocation||originHash){ if(cur_offset!=target){ if(!(cur_offset==0&&target <=0)){ the_win.trigger('avia_smooth_scroll_start'); $('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function(){ if(window.history.replaceState) window.history.replaceState("", "", newHash); }); }} e.preventDefault(); }} }}); }); };})(jQuery); function avia_iframe_fix(container){ var iframe=jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame)', container), youtubeEmbed=jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame) object, iframe[src*="youtube.com"]:not(.av_youtube_frame) embed', container).attr('wmode','opaque'); iframe.each(function(){ var current=jQuery(this), src=current.attr('src'); if(src){ if(src.indexOf('?')!==-1){ src +="&wmode=opaque&rel=0"; }else{ src +="?wmode=opaque&rel=0"; } current.attr('src', src); }}); } function avia_small_fixes(container){ if(!container) container=document; var win=jQuery(window), iframes=jQuery('.avia-iframe-wrap iframe:not(.avia-slideshow iframe):not(iframe.no_resize):not(.avia-video iframe)', container), adjust_iframes=function(){ iframes.each(function(){ var iframe=jQuery(this), parent=iframe.parent(), proportions=56.25; if(this.width&&this.height){ proportions=(100/ this.width) * this.height; parent.css({"padding-bottom":proportions+"%"}); }}); }; adjust_iframes(); } function avia_scroll_top_fade(){ var win=$(window), timeo=false, scroll_top=$('#scroll-top-link'), set_status=function(){ var st=win.scrollTop(); if(st < 500){ scroll_top.removeClass('avia_pop_class'); } else if(!scroll_top.is('.avia_pop_class')){ scroll_top.addClass('avia_pop_class'); }}; win.on('scroll', function(){ window.requestAnimationFrame(set_status); }); set_status(); } function avia_hamburger_menu(){ var header=$('#header'), header_main=$('#main .av-logo-container'), menu=$('#avia-menu'), burger_wrap=$('.av-burger-menu-main a'), htmlEL=$('html').eq(0), overlay=$('
'), overlay_scroll=$('
').appendTo(overlay), inner_overlay=$('
').appendTo(overlay_scroll), bgColor=$('
').appendTo(overlay), animating=false, first_level={}, logo_container=$('.av-logo-container .inner-container'), menu_in_logo_container=logo_container.find('.main_menu'), cloneFirst=htmlEL.is('.html_av-submenu-display-click.html_av-submenu-clone, .html_av-submenu-display-hover.html_av-submenu-clone'), menu_generated=false, cloned_menu_cnt=0; var alternate=$('#avia_alternate_menu'); if(alternate.length > 0){ menu=alternate; } var set_list_container_height=function(){ if($.avia_utilities.isMobile){ overlay_scroll.outerHeight(window.innerHeight); }}, create_list=function(items , append_to){ if(!items) return; var list, link, current, subitems, megacolumns, sub_current, sub_current_list, new_li, new_ul; items.each(function(){ current=$(this); subitems=current.find(' > .sub-menu > li'); if(subitems.length==0){ subitems=current.find(' > .children > li'); } megacolumns=current.find('.avia_mega_div > .sub-menu > li.menu-item'); var cur_menu=current.find('>a'); var clone_events=true; if(cur_menu.length){ if(cur_menu.get(0).hash=='#'||'undefined'==typeof cur_menu.attr('href')||cur_menu.attr('href')=='#'){ if(subitems.length > 0||megacolumns.length > 0){ clone_events=false; }} } link=cur_menu.clone(clone_events).attr('style',''); if('undefined'==typeof cur_menu.attr('href')){ link.attr('href', '#'); } new_li=$('
  • ').append(link); var cls=[]; if('undefined'!=typeof current.attr('class')){ cls=current.attr('class').split(/\s+/); $.each(cls, function(index, value){ if(( value.indexOf('menu-item')!=0)&&(value.indexOf('page-item') < 0)&&(value.indexOf('page_item')!=0)&&(value.indexOf('dropdown_ul') < 0)){ new_li.addClass(value); } return true; }); } if('undefined'!=typeof current.attr('id')&&''!=current.attr('id')){ new_li.addClass(current.attr('id')); }else{ $.each(cls, function(index, value){ if(value.indexOf('page-item-') >=0){ new_li.addClass(value); return false; }}); } append_to.append(new_li); if(subitems.length){ new_ul=$('